-
Notifications
You must be signed in to change notification settings - Fork 0
[CI] (a283762) next-js/15-pages-router-saas #198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Now I have read all the changed files. Let me compile the PR evaluation report based on my analysis. PR Evaluation ReportSummaryThis PR integrates PostHog analytics into a Next.js 15 Pages Router SaaS application. It adds both client-side (
Confidence score: 4/5 👍
File changes
App sanity check: 4/5 ✅
Issues
|
| Criteria | Result | Description |
|---|---|---|
| PostHog SDKs installed | Yes | Both posthog-js@^1.324.1 and posthog-node@^5.21.0 added to dependencies |
| PostHog client initialized | Yes | Client via instrumentation-client.ts, server via singleton in lib/posthog-server.ts |
| capture() | Yes | Extensive capture calls across 11 files tracking key user actions |
| identify() | Partial | Server-side uses user ID consistently; client-side uses email in login.tsx causing identity fragmentation |
| Error tracking | Yes | capture_exceptions: true enabled client-side; manual captureException calls on errors; server-side error events tracked |
| Reverse proxy | Yes | /ingest rewrites configured in next.config.ts to bypass ad blockers |
Issues
- Identity mismatch between client and server: Client-side
posthog.identify()inlogin.tsxusesdata.emailas the distinct ID, while server-side usesuser.id.toString(). This will create duplicate user profiles in PostHog and break user journey analysis. Should use user ID consistently. [MEDIUM] - Missing flush() calls in API routes: Server-side
posthog.capture()calls don't awaitposthog.flush()before the response returns. In serverless environments, the function may terminate before events are sent to PostHog, causing data loss. [MEDIUM] - Webhook uses Stripe customer ID: In
webhook.ts, the distinct ID issubscription.customer as string(Stripe customer ID) which may not match the PostHog user profile. Consider using: falseor mapping to internal user ID. [LOW]
Other completed criteria
- Correct API host configuration (
/ingestfor client, env var for server) - Uses
defaults: '2025-05-24'for recommended defaults - Debug mode enabled in development
skipTrailingSlashRedirect: trueproperly configured- No PII in event properties (only necessary identifiers)
- Proper server-side singleton pattern with shutdown export
PostHog insights and events: 4/5 ✅
| Filename | PostHog events | Description |
|---|---|---|
components/login.tsx |
sign_in_form_submitted, sign_up_form_submitted, sign_in_failed, sign_up_failed, captureException |
Tracks auth form submissions, failures, and exceptions; enables conversion analysis |
pages/api/auth/sign-in.ts |
user_signed_in, sign_in_error |
Server-side sign-in success with user properties; error tracking |
pages/api/auth/sign-up.ts |
user_signed_up, sign_up_error |
New user registration with team and invite context |
pages/api/stripe/checkout.ts |
checkout_completed, checkout_completion_error |
Checkout completion with subscription and plan details |
pages/api/stripe/create-checkout.ts |
checkout_started, checkout_error |
Checkout initiation with price and team context |
pages/api/stripe/webhook.ts |
subscription_updated, subscription_cancelled |
Subscription lifecycle events for churn analysis |
pages/api/team/invite.ts |
team_member_invited, team_invite_error |
Team growth tracking with role information |
pages/api/team/remove-member.ts |
team_member_removed, team_remove_error |
Team churn tracking |
pages/api/account/update.ts |
account_updated, account_update_error |
Profile updates with user identification |
pages/pricing.tsx |
pricing_plan_selected, captureException |
Plan selection with pricing details for funnel analysis |
Issues
- No pageview tracking explicitly configured: While
posthog-jsmay auto-capture pageviews, explicit configuration would be more reliable for Pages Router. [LOW] - Error events use 'anonymous' distinct ID: All error events in catch blocks use
distinctId: 'anonymous'. While understandable when user context is unavailable, these won't associate with user profiles. Consider using the request session if available. [LOW]
Other completed criteria
- Events capture real user actions (sign-up, sign-in, checkout, team management)
- Events enable key product funnels (signup → pricing → checkout → completion)
- Events enriched with relevant properties (teamId, planName, priceId, role)
- Both success and failure states tracked
- Subscription lifecycle captured for churn analysis
- Setup report includes recommended dashboard insights
Reviewed by wizard workbench PR evaluator
Automated wizard CI run
Source: manual
Trigger ID:
a283762App:
next-js/15-pages-router-saasApp directory:
apps/next-js/15-pages-router-saasWorkbench branch:
wizard-ci-a283762-next-js-15-pages-router-saasWizard branch:
mainExamples branch:
mainPostHog (MCP) branch:
masterTimestamp: 2026-01-15T22:38:20.209Z
Duration: 382.5s